import request from '@/utils/request'
// import Qs from 'qs'

export function checkComNameBeforepdate(name, id) {
  return request({
    url: '/com/check/name/beforeUpdate',
    method: 'get',
    params: { name, id }
  })
}
export function fetchComList(query) {
  return request({
    url: '/com/list',
    method: 'get',
    params: query
  })
}
export function fetchComInfo(id) {
  return request({
    url: '/com/detail',
    method: 'get',
    params: { id }
  })
}

export function fetchComInfoByToken() {
  return request({
    url: '/com/detail/auth',
    method: 'get'
  })
}

export function fetchComByName(name) {
  return request({
    url: '/com/detail/name',
    method: 'get',
    params: { name }
  })
}

export function fetchComNames() {
  return request({
    url: '/com/options',
    method: 'get'
  })
}
export function fetchComMemberList(query) {
  return request({
    url: '/com/member/list',
    method: 'get',
    params: query
  })
}
export function fetchComPositionOptions(id) {
  return request({
    url: '/com/position/options',
    method: 'get',
    params: { id }
  })
}

export function deleteMember(oid, uid) {
  return request({
    url: '/com/member/delete',
    method: 'get',
    params: { oid, uid }
  })
}

export function updateCom(data) {
  return request({
    url: '/com/update',
    method: 'post',
    data
  })
}
export function createCom(data) {
  return request({
    url: '/com/register',
    method: 'post',
    data
  })
}

export function updateMemberData(data) {
  return request({
    url: '/com/update/member',
    method: 'post',
    data
  })
}
